<script setup lang="ts">
// axios已经自带了类型生命文件
import axios from 'axios'
// lodash这种比较老的库，要安装对应的类型文件才会有提示
// @types/库的名称
// import lodash from 'lodash'
import { ref } from 'vue'
// 这里导入自定义类型声明文件，不需要加.d.ts这个后缀
import { Person } from '../types/data'

const person = ref<Person>({} as Person)

setTimeout(() => {
  person.value = {
    id: 1001,
    name: 'zhangsan',
    age: 30
  }
}, 2000)

axios.create({
  baseURL: ''
})

defineProps<{ msg: string }>()

const count = ref(0)
</script>

<template>
  <h1>{{ msg }}</h1>

  <div class="card">
    <button type="button" @click="count++">count is {{ count }}</button>
    <p>
      Edit
      <code>components/HelloWorld.vue</code> to test HMR
    </p>
    person {{ person }}
  </div>
</template>

<style scoped>
.read-the-docs {
  color: #888;
}
</style>
